package com.uphone.edwards.pro.activity.login;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.uphone.edwards.R;
import com.uphone.edwards.adapter.ContanctsAdapter;
import com.uphone.edwards.util.LanguageUtils;
import com.uphone.edwards.util.SharedUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ContanctsActivity extends AppCompatActivity {
    @BindView(R.id.ll_return)
    LinearLayout llReturn;
    private ContanctsAdapter cAdapter;
    @BindView(R.id.lv_contancts)
    ListView lvContancts;

    @Override
    protected void attachBaseContext(Context newBase) {
        //获取我们存储的语言环境 比如 "en","zh",等等
        /**
         * attach对应语言环境下的context
         */
        String lang = SharedUtils.getShareLanguage(newBase);
        super.attachBaseContext(LanguageUtils.attachBaseContext(newBase, lang));

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_contancts);
        ButterKnife.bind(this);
        cAdapter = new ContanctsAdapter(this);
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("a");
        list.add("a");
        list.add("a");
        list.add("a");
        list.add("a");
        list.add("a");
        list.add("a");
        list.add("a");
        list.add("other");
        lvContancts.setAdapter(cAdapter);
        cAdapter.setData(list);
    }

    @OnClick({R.id.ll_return})
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.ll_return:
                finish();
                break;
        }
    }
}
